package com.service.buloImplement;

import org.apache.tools.ant.util.SymbolicLinkUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.VisitorRegisterManage.dao.UsersMapper;
import com.VisitorRegisterManage.dao.VisitorsMapper;
import com.VisitorRegisterManage.pojo.Users;
import com.VisitorRegisterManage.pojo.Visitors;
import com.service.buloInterface.AllServiceInterface;

/** 
 * 业务逻辑层  更新接口的实现类
* @author Sunyelw yellowsunsna@foxmail.com 
* @version 创建时间：2018年1月10日 下午7:51:20 
* 类说明  
*/
@Service
public class AllServiceImpl implements AllServiceInterface {

	public static final String SUCCESS = "SUCCESS"; 
	public static final String ERROR = "ERROR"; 
	
	@Autowired
	VisitorsMapper visitorsMapper;  // dao层的接口, 自动注入其实现类
	
	@Autowired
	UsersMapper usersMapper;
	
	public String updateVisitor(Visitors visitor) {
		
		return visitorsMapper.updateByPrimaryKeySelective(visitor)==1? SUCCESS : ERROR;
	}

	@Override
	public String updateUser(Users user) {

		return usersMapper.updateByPrimaryKeySelective(user)==1? SUCCESS : ERROR;
	}

	@Override
	public String insertVisitor(Visitors visitor) {
		int n = visitorsMapper.insert(visitor);
		System.out.println( n );
		return n==1 ? SUCCESS : ERROR;
	}

}
